package com.tarena.lbs.business.dao.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tarena.lbs.activity.pojo.vo.ActivityVO;
import com.tarena.lbs.business.pojo.po.StorePO;
import com.tarena.lbs.business.pojo.query.StoreQuery;
import com.tarena.lbs.business.pojo.vo.StoreVO;

import com.tarena.lbs.business.pojo.vo.StoreVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

import java.util.List;

@Mapper
public interface StoreMapper extends BaseMapper<StorePO> {
    List<StoreVO> selectPageList(StoreQuery query);

    @Select("SELECT id,business_id as bussinessId,store_name as storeName,store_phone as storePhone,store_head_name as storeHeadName,store_logo as storeLogo,store_head_phone as storeHeadPhone,province_id as provinceId,area_id as areaId,city_id as cityId,store_location as storeLocation,store_longitude as storeLongitude,store_latitude as storeLatitude " +
            "FROM lbs_store " +
            "WHERE business_id=#{businessId} " +
            "AND store_status=0")
    List<StoreVO> selectStoreListByBusinessId(@Param("businessId") Integer businessId);

    @Select("SELECT * FROM lbs_store WHERE business_id = #{id} OR id = #{id}")
    StorePO selectById(Integer id);

    @Select("SELECT * FROM tarena_lbs_activity.activity WHERE business_id = #{id}")
    List<ActivityVO> selectActivity(Integer id);

}
